.TH "Slurm API" "3" "Slurm job step information functions" "April 2015" "Slurm job step information functions"

.SH "NAME"
slurm_free_job_step_info_response_msg, slurm_get_job_steps,
slurm_print_job_step_info, slurm_print_job_step_info_msg
\- Slurm job step information reporting functions

.SH "SYNTAX"
.LP
#include <stdio.h>
.br
#include <slurm/slurm.h>
.LP
void \fBslurm_free_job_step_info_response_msg\fR (
.br
	job_step_info_response_msg_t *\fIjob_step_info_msg_ptr\fP
.br
);
.LP
void \fBslurm_get_job_steps\fR (
.br
	time_t *\fIupdate_time\fP,
.br
	uint32_t \fIjob_id\fP,
.br
	uint32_t \fIstep_id\fP,
.br
	job_step_info_response_msg_t **\fIjob_step_info_msg_pptr\fP,
.br
	uint16_t \fIshow_flags\fP
.br
);
.LP
void \fBslurm_print_job_step_info\fR (
.br
	FILE *\fIout_file\fp,
.br
	job_step_info_t *\fIjob_step_ptr\fP,
.br
	int \fIone_liner\fP
.br
);
.LP
void \fBslurm_print_job_step_info_msg\fR (
.br
	FILE *\fIout_file\fp,
.br
	job_step_info_response_msg_t *\fIjob_step_info_msg_ptr\fP,
.br
	int \fIone_liner\fP
.br
);
.SH "ARGUMENTS"
.LP
.TP
\fIjob_id\fP
Specifies a slurm job ID. A value of zero implies all jobs.
.TP
\fIjob_step_info_msg_pptr\fP
Specifies the double pointer to the structure to be created and filled
with the time of the last node update, a record count, and detailed
information about each job step specified. Detailed job step information
is written to fixed sized records and includes: job_id, step_id, node
names, etc. See slurm.h for full details on the data structure's contents.
.TP
\fIjob_step_info_msg_ptr\fP
Specifies the pointer to the structure created by the function
\fBslurm_get_job_steps\fP.
.TP
\fIjob_step_ptr\fP
Specifies a pointer to a single job step records from the \fIjob_step_info_msg_pptr\fP
data structure.
.TP
\fIone_liner\fP
Print one record per line if non\-zero.
.TP
\fIout_file\fP
Specifies the file to print data to.
.TP
\fIshow_flags\fP
Job filtering flags, may be ORed.
Information about job steps in partitions that are configured as
hidden and partitions that the user's group is unable to utilize
are not reported by default.
The \fBSHOW_ALL\fP flag will cause information about job steps in all
partitions to be displayed.

.TP
\fIstep_id\fP
Specifies a slurm job step ID. A value of zero implies all job steps.
.TP
\fIupdate_time\fP
For all of the following informational calls, if update_time is equal to or greater than the last time changes where made to that information, new information is not returned.  Otherwise all the configuration. job, node, or partition records are returned.
.SH "DESCRIPTION"
.LP
\fBslurm_free_job_step_info_response_msg\fR Release the storage generated by
the \fBslurm_get_job_steps\fR function.
.LP
\fBslurm_get_job_steps\fR Loads into details about job steps that satisfy
the \fIjob_id\fP and/or \fIstep_id\fP specifications provided if the data
has been updated since the \fIupdate_time\fP specified.
.LP
\fBslurm_print_job_step_info\fR Prints the contents of the data structure
describing a single job step records from the data loaded by the
\fslurm_get_job_steps\fR function.
.LP
\fBslurm_print_job_step_info_msg\fR Prints the contents of the data
structure describing all job step records loaded by the
\fslurm_get_job_steps\fR function.
.SH "RETURN VALUE"
.LP
On success, zero is returned. On error, \-1 is returned, and Slurm error
code is set appropriately.
.SH "ERRORS"
.LP
\fBSLURM_NO_CHANGE_IN_DATA\fR Data has not changed since \fBupdate_time\fR.
.LP
\fBSLURM_PROTOCOL_VERSION_ERROR\fR Protocol version has changed, re\-link your code.
.LP
\fBSLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT\fR Timeout in communicating with
Slurm controller.
.SH "EXAMPLE"
.LP
#include <stdio.h>
.br
#include <stdlib.h>
.br
#include <slurm/slurm.h>
.br
#include <slurm/slurm_errno.h>
.LP
int main (int argc, char *argv[])
.br
{
.br
	int i;
.br
	job_step_info_response_msg_t * step_info_ptr = NULL;
.br
	job_step_info_t * step_ptr;
.LP
	/* get and dump some job information */
.br
	if ( slurm_get_job_steps ((time_t) NULL, 0, 0,
.br
	                          &step_info_ptr, SHOW_ALL) ) {
.br
		slurm_perror ("slurm_get_job_steps error");
.br
		exit (1);
.br
	}
.LP
	/* The easy way to print... */
.br
	slurm_print_job_step_info_msg (stdout,
.br
	                               step_info_ptr, 0);
.LP
	/* A harder way.. */
.br
	for (i = 0; i < step_info_ptr\->job_step_count; i++) {
.br
		step_ptr = &step_info_ptr\->job_steps[i];
.br
		slurm_print_job_step_info(stdout, step_ptr, 0);
.br
	}
.LP
	/* The hardest way. */
.br
	printf ("Steps updated at %lx, record count %d\\n",
.br
	        step_info_ptr\->last_update,
.br
	        step_info_ptr\->job_step_count);
.br
	for (i = 0; i < step_info_ptr\->job_step_count; i++) {
.br
		printf ("JobId=%u StepId=%u\\n",
.br
			step_info_ptr\->job_steps[i].job_id,
.br
			step_info_ptr\->job_steps[i].step_id);
.br
	}
.LP
	slurm_free_job_step_info_response_msg(step_info_ptr);
.br
	exit (0);
.br
}

.SH "NOTES"
These functions are included in the libslurm library,
which must be linked to your process for use
(e.g. "cc \-lslurm myprog.c").
.LP
Some data structures contain index values to cross\-reference each other.
If the \fIshow_flags\fP argument is not set to SHOW_ALL when getting this
data, these index values will be invalid.
.LP
The \fBslurm_hostlist_\fR functions can be used to convert Slurm node list
expressions into a collection of individual node names.

.SH "COPYING"
Copyright (C) 2002\-2006 The Regents of the University of California.
Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
CODE\-OCEC\-09\-009. All rights reserved.
.LP
This file is part of Slurm, a resource management program.
For details, see <https://slurm.schedmd.com/>.
.LP
Slurm is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
.LP
Slurm is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
details.

.SH "SEE ALSO"
.LP
\fBscontrol\fR(1), \fBsqueue\fR(1),
\fBslurm_hostlist_create\fR(3), \fBslurm_hostlist_shift\fR(3),
\fBslurm_hostlist_destroy\fR(3),
\fBslurm_get_errno\fR(3), \fBslurm_load_jobs\fR(3),
\fBslurm_perror\fR(3), \fBslurm_strerror\fR(3)

